<template>
  <div>
    <input type="file" ref="fileInput" @change="handleFileChange">
    <button @click="uploadFile">Upload</button>
  </div>
</template>

<script>
import { uploadFile } from '@/api/test';

export default {
  data() {
    return {
      file: null
    };
  },
  methods: {
    handleFileChange(event) {
      this.file = event.target.files[0];
      console.log(this.file)
    },
    async uploadFile() {

      try {
        const response = await uploadFile(this.file);
        console.log('File uploaded successfully');
        console.log(response.data);
      } catch (error) {
        console.error('File upload failed:', error);
      }
    }
  }
};
</script>
